package org.woosiyuan.interceptor;

import javax.xml.registry.infomodel.User;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class AuthorityInterceptor extends AbstractInterceptor {

	@Override
	public String intercept(ActionInvocation arg0) throws Exception {
		ActionContext ctx= arg0.getInvocationContext();
		User user = (User)ctx.getSession().get("user");
		if(user!=null){
			return arg0.invoke();
		}
		
		ctx.put("tip","您还没有登录，请先登录");
		return Action.LOGIN;
	}
	

}
